package com.pay.common;

import java.io.Serializable;
import java.util.List;

public class Page <T> implements Serializable {
	private static final long serialVersionUID = 1L;

	private long total = 0;

	private List<T> rows = null;
	
    public  int pageSize = PageUtil.DEFAULT_PAGE_SIZE;
	
	/**
	 * @return 返回 pageSize
	 */
	public int getPageSize() {
		return pageSize;
	}

	/**
	 * @param pageSize 参数 pageSize
	 */
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public Page() {
		super();
	}

	public Page(long total, List<T> rows) {
		this.total = total;
		this.rows = rows;
	}

	public long getTotal() {
		return total;
	}

	public void setTotal(long total) {
		this.total = total;
	}

	public List<T> getRows() {
		return rows;
	}

	public void setRows(List<T> rows) {
		this.rows = rows;
	}
	
	
	public int getLastPage()
	{
		if (pageSize != 0) {
			if (total % pageSize != 0) {
				return (int)total / pageSize + 1;
			} else {
				return (int)total / pageSize;
			}
		} else {
			return 0;
		}
	}
	
}
